package com.hooda.servlet;

import com.hooda.server.Request;
import com.hooda.server.Response;

/**
 * @author zhangzp
 * @version 1.0, 2021/10/11
 */
public abstract class HttpServlet implements Servlet {


    @Override
    public void init() throws Exception {

    }

    @Override
    public void destroy() throws Exception {

    }

    @Override
    public void service(Request request, Response response) throws Exception {
        if ("GET".equalsIgnoreCase(request.getMethod())) {
            doGet(request, response);
        } else {
            doPost(request, response);
        }
    }

    public abstract void doGet(Request request, Response response);

    public abstract void doPost(Request request, Response response);
}
